package com.umanji.enterprise.domain;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.UUID;

import javax.persistence.AttributeOverrides;
import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.umanji.generic.entity.UUIDEntity;
import com.umanji.security.domain.Users;

@Entity
@Table(name="umanji_enterprise_svcitem")
public class ServiceItems extends UUIDEntity<ServiceItems> {

	private static String rootPath = "";	// 기본 저장 폴더

    private String Title;			// 제목
	private String Content;			// 내용
	private Integer Price;			// 가격
	private String discountOption;	// 할인등 옵션

    @ManyToMany( mappedBy = "serviceItems", targetEntity = Enterprises.class )
    private Collection<Enterprises> enterprises;

	private Date uploadedDate;	// 파일 생성일
	private Date modifiedDate;	// 파일 수정일

    public ServiceItems() {
    	this.enterprises = new ArrayList<Enterprises>();
    }
    
    public ServiceItems(String title, String content, Integer price, String dscOpt) {
    	enterprises = new ArrayList<Enterprises>();
        this.Title = title;
        this.Content = content;
        this.Price = price;
        this.discountOption = dscOpt;
    }

    public String getTitle() {
		return Title;
	}

	public void setTitle(String Title) {
		this.Title = Title;
	}

	public String getContent() {
		return Content;
	}

	public void setContent(String Content) {
		this.Content = Content;
	}

    public Collection<Enterprises> getEnterprises() {
        return enterprises;
    }
    
    public void setEnterprises(Enterprises enterprise) {
        if (!getEnterprises().contains(enterprise)) {
        	getEnterprises().add(enterprise);
        }
        if (!enterprise.getServiceItems().contains(this)) {
        	enterprise.getServiceItems().add(this);
        }
    }

	public Date getUploadedDate() {
		return uploadedDate;
	}

	public void setUploadedDate(Date uploadedDate) {
		this.uploadedDate = uploadedDate;
	}

	public Date getModifiedDate() {
		return modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		this.modifiedDate = modifiedDate;
	}

	public Integer getPrice() {
		return Price;
	}

	public void setPrice(Integer price) {
		Price = price;
	}

	public String getDiscountOption() {
		return discountOption;
	}

	public void setDiscountOption(String discountOption) {
		this.discountOption = discountOption;
	}
	
}